negotiator
Class Domain

java.lang.Object
  extended by negotiator.Domain
All Implemented Interfaces:
java.io.Serializable

public class Domain
extends java.lang.Object
implements java.io.Serializable

Representation of the outcome space of a scenario.

Author:
Dmytro Tykhonov & Koen Hindriks
See Also:
Serialized Form

Constructor Summary
Domain()
          Creates an empty domain.
Domain(java.io.File filename)
          read a domain from a file.
Domain(SimpleElement root)
          Creates a domain given an XML-representation of the domain.
Domain(java.lang.String filename)
          Creates a domain given the path to a file with an XML-representation.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 Objective getIssue(int index)
          Returns an issue with a given index.
 java.util.ArrayList<Issue> getIssues()
          Returns all issues as an arraylist.
 java.lang.String getName()
           
 long getNumberOfPossibleBids()
          get number of all possible bids.
 Objective getObjective(int ID)
           
 java.util.ArrayList<Objective> getObjectives()
           
 Objective getObjectivesRoot()
           
 Bid getRandomBid()
          KH 070511: Moved to here since it is generic method that can be made available to all agents.
 Bid getRandomBid(java.util.Random r)
          KH 070511: Moved to here since it is generic method that can be made available to all agents.
 SimpleElement getXMLRoot()
           
 int hashCode()
           
 void setObjectivesRoot(Objective ob)
          Sets a new domain root.
 SimpleElement toXML()
          Creates an XML representation of this domain.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Domain

public Domain()
Creates an empty domain.


Domain

public Domain(SimpleElement root)
Creates a domain given an XML-representation of the domain.

Parameters:
root - XML-representation of the domain.

Domain

public Domain(java.lang.String filename)
       throws java.lang.Exception
Creates a domain given the path to a file with an XML-representation.

Parameters:
filename -
Throws:
java.lang.Exception

Domain

public Domain(java.io.File filename)
       throws java.lang.Exception
read a domain from a file.

Parameters:
filename -
Throws:
java.lang.Exception - if
Method Detail

getXMLRoot

public SimpleElement getXMLRoot()
Returns:
XML-representation of this domain.

getIssue

public final Objective getIssue(int index)
Returns an issue with a given index. Considers issues in the domain tree as a plain array (uses getIssues method to generate the array).

Parameters:
index - of the issue.
Returns:
issue with the given index.

getObjective

public final Objective getObjective(int ID)
Parameters:
ID - (number) of the objective
Returns:
the objective with given ID

getObjectivesRoot

public final Objective getObjectivesRoot()
Returns:
the highest level objctive.

setObjectivesRoot

public final void setObjectivesRoot(Objective ob)
Sets a new domain root.

Parameters:
ob - The new root Objective

getRandomBid

public final Bid getRandomBid()
KH 070511: Moved to here since it is generic method that can be made available to all agents. Wouter: NOTE, it is NOT checked whether the bid has a utility>0.

Returns:
a random bid

getRandomBid

public final Bid getRandomBid(java.util.Random r)
KH 070511: Moved to here since it is generic method that can be made available to all agents. Wouter: NOTE, it is NOT checked whether the bid has a utility>0.

Parameters:
r - random variable
Returns:
a random bid

toXML

public SimpleElement toXML()
Creates an XML representation of this domain.

Returns:
the SimpleElements representation of this Domain or null when there was an error.

getObjectives

public java.util.ArrayList<Objective> getObjectives()
Returns:
all objectives (note, issues are also objectives!) in the domain

getIssues

public java.util.ArrayList<Issue> getIssues()
Returns all issues as an arraylist. Note that it is wise cache the issues, as this implementation is quite computationally expensive.

Returns:
arraylist of all issues in the domain.

getNumberOfPossibleBids

public long getNumberOfPossibleBids()
get number of all possible bids. Does not care of constraints. Not finished!!!

Returns:
long number of all possible bids in the domain.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getName

public java.lang.String getName()
Returns:
name of the given domain.